package com.sctvcloud.bazhong.http;

import java.lang.reflect.Type;

/**
 * Created by Ly on 2016/11/29.
 */
public abstract class AbsNetCallBack<T> implements INetCallback<T> {
    protected Class<T> cls;
    protected Type type;

    protected int int1;
    protected int int2;

    protected Object obj;

    protected boolean isTesting;

    protected String requestUrls;

    public AbsNetCallBack(Class<T> cls) {
        this.cls = cls;
    }

    public AbsNetCallBack(Class<T> cls, int i1) {
        this.cls = cls;
        this.int1 = i1;
    }

    public AbsNetCallBack(Class<T> cls, Object obj) {
        this.cls = cls;
        this.obj = obj;
    }

    public AbsNetCallBack(Class<T> cls, Object obj, int i1) {
        this.cls = cls;
        this.obj = obj;
        this.int1 = i1;
    }

    public AbsNetCallBack(Type type) {
        this.type = type;
    }

    @Override
    public T doInBackground(T t) {
        return t;
    }

    @Override
    public void onPrepare() {
    }

    @Override
    public void onError(Throwable ex, String errorMsg, int netCode) {
        onError(ex, errorMsg);
    }

    public int getInt1() {
        return int1;
    }

    public AbsNetCallBack setInt1(int int1) {
        this.int1 = int1;
        return this;
    }

    public int getInt2() {
        return int2;
    }

    public AbsNetCallBack setInt2(int int2) {
        this.int2 = int2;
        return this;
    }

    public Object getObj() {
        return obj;
    }

    public AbsNetCallBack<T> setObj(Object obj) {
        this.obj = obj;
        return this;
    }

    @Override
    public void onEnd() {
    }

    @Override
    public void onError(Throwable ex, String errorMsg) {
    }

    @Override
    public Class<T> getParseClass() {
        return cls;
    }

    @Override
    public Type getParseType() {
        return type;
    }

    @Override
    public void setIsTest(boolean isTest) {
        isTesting = isTest;
    }

    @Override
    public void setSome(Object o) {
        obj = o;
    }

    @Override
    public void setRequestUrl(String str) {
        requestUrls=str;
    }

    @Override
    public boolean whenLoginExpiredBackGround() {
        return false;
    }
}
